package com.example.designpatternproject;


import android.os.Bundle;

import com.example.base.BaseActivity;
import com.example.designpatternproject.builder.BuilderActivity;
import com.example.designpatternproject.databinding.ActivityMainBinding;
import com.example.designpatternproject.observer.ObserverActivity;
import com.example.designpatternproject.proxy.ProxyActivity;
import com.example.designpatternproject.wrapper.WrapperActivity;
import com.example.ext.ActivityExtKt;

import java.util.Objects;

public class MainActivity extends BaseActivity<ActivityMainBinding> {
    @Override
    public void initView(Bundle savedInstanceState) {

        Objects.requireNonNull(getSupportActionBar()).setTitle("设计模式实战");

        // 工厂模式
        binding.bt1.setOnClickListener(v ->
                ActivityExtKt.jumpActivity(MainActivity.this, v, BuilderActivity.class));
        /*
         * 作者:史大拿
         * 创建时间: 10/19/22 3:30 PM
         * TODO 装饰器设计模式
         * 给RecyclerView添加头尾布局
         */
        binding.bt2.setOnClickListener(v ->
                ActivityExtKt.jumpActivity(MainActivity.this, v, WrapperActivity.class));

        /*
         * 作者:史大拿
         * 创建时间: 10/26/22 2:59 PM
         * TODO 单例模式 + 观察者模式
         */
        binding.bt3.setOnClickListener(v ->
                ActivityExtKt.jumpActivity(MainActivity.this, v, ObserverActivity.class));


        /*
         * 作者:史大拿
         * 创建时间: 10/26/22 8:01 PM
         * TODO 动态代理
         */
        binding.bt4.setOnClickListener(v ->
                ActivityExtKt.jumpActivity(MainActivity.this, v, ProxyActivity.class));
    }
}